package com.xiao.springmvc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiao.springmvc.entity.ProductImage;
import com.xiao.springmvc.jpa.ProductImageDao;

@Service
public class ProductImageService {

	@Autowired
	private ProductImageDao productImageDao;

	public ProductImage findByProductIdAndOrderId(long productId,int orderId){
		return productImageDao.findByProductIdAndOrderId(productId, orderId);
	}
	
	public List<ProductImage> findByProductId(long productId){
//		return productImageDao.findByProductId(productId,1,12);
		return productImageDao.findByProductIdAndOrderIdBetweenOrderByOrderIdAsc(productId, 1, 12);
	}
}
